!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("rb_wixui.thunderbolt[TextInput]",["react"],t):"object"==typeof exports?exports["rb_wixui.thunderbolt[TextInput]"]=t(require("react")):e["rb_wixui.thunderbolt[TextInput]"]=t(e.React)}("u">typeof self?self:this,e=>(()=>{"use strict";var t={89094(e,t,r){var n=r(87006),i=Symbol.for("react.element"),a=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),o=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var n,s={},u=null,d=null;for(n in void 0!==r&&(u=""+r),void 0!==t.key&&(u=""+t.key),void 0!==t.ref&&(d=t.ref),t)a.call(t,n)&&!l.hasOwnProperty(n)&&(s[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===s[n]&&(s[n]=t[n]);return{$$typeof:i,type:e,key:u,ref:d,props:s,_owner:o.current}}t.jsx=s,t.jsxs=s},36870(e,t,r){e.exports=r(89094)},87006(t){t.exports=e}},r={};function n(e){var i=r[e];if(void 0!==i)return i.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.d=(e,t,r)=>{var i=(t,r)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,[r]:t[i]})};i(t,"get"),i(r,"value")},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{let e;n.r(i),n.d(i,{components:()=>y});var t=n(36870),r=n(87006);let a=function(){for(var e,t,r=0,n="";r{let r=[];return e&&r.push(`${o}${e}`),t.forEach(e=>{e&&(r.push(`${o}${e}`),r.push(e))}),r.join(" ")};function s(e){return t=>{t.keyCode===e&&(t.preventDefault(),t.stopPropagation(),t.currentTarget.click())}}s(32),s(13),s(27);let u=["aria-id","aria-metadata","aria-type"],d=({size:e,...t})=>r.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",width:e||"20",height:e||"20",...t},r.createElement("path",{fillRule:"evenodd",d:"M9.5,3 C13.084,3 16,5.916 16,9.5 C16,13.084 13.084,16 9.5,16 C5.916,16 3,13.084 3,9.5 C3,5.916 5.916,3 9.5,3 Z M9.5,4 C6.467,4 4,6.467 4,9.5 C4,12.533 6.467,15 9.5,15 C12.533,15 15,12.533 15,9.5 C15,6.467 12.533,4 9.5,4 Z M10,11 L10,12 L9,12 L9,11 L10,11 Z M10,7 L10,10 L9,10 L9,7 L10,7 Z"}));d.displayName="ErrorSmall";let c=e=>{let{errorMessage:t,errorMessageType:r,shouldShowValidityIndication:n,translations:i,componentViewMode:a}=e,o="editor"===a?i?.errorMessage||"Error text displays here.":t;return"inline"===r&&n?o:void 0},p=e=>{let{dataHook:r,id:n}=e,i=c(e);return i?(0,t.jsxs)("div",{id:n,"data-hook":r||"inline-error-message",className:"Z0mg9X",children:[(0,t.jsx)(d,{className:"mZemNb"}),(0,t.jsx)("span",{className:"TTK5ZL",children:i})]}):null},f={input:"nbaJII",hideNumberSpinner:"BOzGbm",AppsTextInputSkin:"Q1MQrw",appsTextInputSkin:"Q1MQrw",inputWrapper:"nuFEsg",prefix:"wqbFCn","validation-indication":"bcsnlz",validationIndication:"bcsnlz",label:"QyrExM",hasLabel:"pZqgsf","required-indication":"TqroEf",requiredIndication:"TqroEf",ResponsiveTextInputSkin:"Yz8ZCc",responsiveTextInputSkin:"Yz8ZCc"},h=function(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];return Array.from(t).reduce((e,t,r)=>"-"===t?[...e,r]:e,[]).filter((t,n)=>r?t<=e.length:t<=e.length+n)},m=()=>{},y={TextInput:{component:r.forwardRef((e,n)=>{let i,{skin:o,name:s,id:d,className:y="",customClassNames:g=[],dataTestId:b,value:v,inputType:x="text",label:_,placeholder:O,readOnly:E,required:C,isDisabled:I,pattern:j,autoComplete:L,autoComplete_:T,maxLength:w,min:N,max:R,step:M,numberSpinnerHidden:A,shouldShowValidityIndication:P,autoFocus:S,prefix:F,phoneFormat:k="",errorMessageType:V="tooltip",validateValue:D=m,setValidityIndication:$=m,onBlur:q=m,onFocus:Z=m,onKeyPress:H=m,onInput:z=m,onValueChange:B=m,onChange:Q=m,onClick:U=m,onDblClick:Y=m,onMouseEnter:W=m,onMouseLeave:G=m,onHydrationComplete:K=m,ariaAttributes:X,contentRef:J,translations:ee,componentViewMode:et,textInputAutoFillFixEnabled:er,lang:en}=e,ei=r.useRef(null);r.useImperativeHandle(n,()=>({focus:()=>{ei.current?.focus()},blur:()=>{ei.current?.blur()},setCustomValidity:t=>{"message"===t.type?ei.current?.setCustomValidity(t.message):ei.current?.setCustomValidity(((e,t)=>{let{translations:r,phoneFormat:n}=t;switch(e.key){case"PHONE_FORMAT_LENGTH_VALIDATION_ERROR":let i;return i=n,(r?.phoneFormatLengthValidationError||"Please enter a phone number with {digits} digits").replace("{digits}",`${i?i.replace(/-/g,"").length:0}`);case"PHONE_FORMAT_DEFAULT_VALIDATION_ERROR":return r?.phoneFormatDefaultValidationError||"Please enter between 4 to 17 digits. You can include hyphens (-) or start with a (+), e.g., 555-123-4567 or +(222)987654321";case"PHONE_FORMAT_COMPLEX_PHONE_DEFAULT_VALIDATION_ERROR":return r?.phoneFormatComplexPhoneDefaultValidationError||"Please enter between 4 to 17 digits. You can include dividers (-), e.g., 555-123-4567.";default:return e.key}})(t,{translations:e.translations,phoneFormat:e.phoneFormat}))},getValidationMessage:()=>ei.current?.validationMessage}));let ea=r.useRef(),eo=r.useMemo(()=>{let e,t;return"tel"===x&&k?(e=h(v,k,!1),t=Array.from(v),e.forEach(e=>{e{let{shouldHideValidityIndication:t,shouldCallOnInput:r}=e;return e=>{let{value:n}=e.target,i=n;if(k){let e,t=n.length(" "===n[i]?r.splice(i-a,1):" "!==n[i+1]||t?" "===n[i-1]&&t&&(n.split(" ").length-1{el({shouldHideValidityIndication:!0,shouldCallOnInput:!1})({target:{value:ei.current?.value??""}}),K({type:"onHydrationComplete"})},[]);let es=a(f[o],y,l("text-input",...g),{[f.hasLabel]:!!_,[f.requiredIndication]:C,[f.validationIndication]:!!P}),{ariaAttributes:{"aria-label":eu,"aria-describedby":ed,"aria-errormessage":ec,...ep}}=(e=>{let t,{role:r,tabIndex:n,tabindex:i,screenReader:a,lang:o,ariaAttributes:l={}}=e;return{role:r,tabIndex:n??i,screenReader:a,ariaAttributes:(t=Object.entries(l).reduce((e,[t,r])=>({...e,[`aria-${t}`.toLowerCase()]:r}),{}),Object.entries(t).reduce((e,[t,r])=>(u.includes(t)||(e[t]=r),e),{})),lang:o}})({ariaAttributes:X}),ef=()=>!!ei.current&&ei.current===document.activeElement,eh=!!ei.current?.validationMessage&&P,em={errorMessageType:V,errorMessage:ei.current?.validationMessage,shouldShowValidityIndication:!!P,translations:ee,componentViewMode:et},ey=c(em)?`inline-error-message_${d}`:void 0,eg=[ed,ey].filter(Boolean).join(" ")||void 0,eb=ec||(eh?ey:void 0);return(0,t.jsxs)("div",{id:d,...Object.entries(e).reduce((e,[t,r])=>(t.includes("data-")&&(e[t]=r),e),{}),ref:J,className:es,"data-testid":b,onClick:e=>{I||U(e)},onDoubleClick:e=>{I||Y(e)},onMouseEnter:e=>{I||W(e)},onMouseLeave:e=>{I||G(e)},lang:en,children:[!!_&&(0,t.jsx)("label",{htmlFor:`input_${d}`,className:a(f.label,l("text-input__label")),children:_}),(0,t.jsxs)("div",{className:f.inputWrapper,children:[F&&(0,t.jsx)("div",{className:f.prefix,children:F}),(0,t.jsx)("input",{name:s,ref:ei,id:`input_${d}`,className:a(f.input,"has-custom-focus",l("text-input__input"),{[f.hideNumberSpinner]:A}),type:x,value:eo,onFocus:Z,onKeyDown:H,onChange:el({shouldHideValidityIndication:!0,shouldCallOnInput:!0}),onBlur:e=>{q(e),ea.current&&Q({...e,type:"change"}),ea.current=!1,$(!0)},placeholder:O,readOnly:E,required:C,"aria-invalid":eh,pattern:j,maxLength:(i=null===w?void 0:w,k&&(i=k.length),i),minLength:k?k.length:void 0,disabled:I,autoComplete:L?"on":T||"off",step:null===M?void 0:M,min:null===N?void 0:N,max:null===R?void 0:R,autoFocus:S,...eu&&{"aria-label":eu},...!C&&{"aria-required":!1},...ep,"aria-describedby":eg,"aria-errormessage":eb})]}),(0,t.jsx)(p,{...em,id:ey})]})}),controller:(e=e=>{let t,{mapperProps:r,controllerUtils:n}=e;return{...r,...(t=n.updateProps,{onValueChange:e=>{t({value:e})},setValidityIndication:e=>{t({shouldShowValidityIndication:e})}})}},{useComponentProps:(t,r,n)=>e({mapperProps:t,stateValues:r,controllerUtils:{...n,updateStyles:e=>{let t=Object.entries(e).reduce((e,[t,r])=>({...e,[t.startsWith("--")?t:t.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)]:void 0===r?null:r}),{});n.updateStyles(t)}}})})}}})(),i})());